$(function (){


    void function() {
        var PAGE = $('#znn_page_member_index').length;
        console.log(PAGE);
        if (PAGE < 1) return;
        $('.save.ml').on('click',function(){
            var data = {};
            data.nickname = $('.infoForm input[name=nickname]').val();
            data.sex = $('.infoForm input[name=sex]:checked').val();
            data.image = $('.infoForm input[name=image]').val();
            data.birthday = +($('#year').val()*10000) + ($('#month').val() *100) + +$('#day').val();
            $.post('/userapi/update',data,function(data){
                data = JSON.parse(data);
                if(data.status){
                    layer.msg(data.msg, {
                        time: 20000, //20s后自动关闭
                        btn: ['回到首页']
                    },function(){
                        window.location = '/pet.html';
                    });

                }else{
                    layer.msg(data.msg);
                }
            },'json');
        });

    }();

});